package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConScienceFeedback;
import com.htgd.gardenexpo.dao.GeConScienceFeedbackDao;
import com.htgd.gardenexpo.service.GeConScienceFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConScienceFeedback)表服务实现类
 *
 * @author makejava
 * @since 2021-06-09 16:41:33
 */
@Service("geConScienceFeedbackService")
public class GeConScienceFeedbackServiceImpl implements GeConScienceFeedbackService {
    @Resource
    private GeConScienceFeedbackDao geConScienceFeedbackDao;

    /**
     * 通过ID查询单条数据
     *
     * @param 主键
     * @return 实例对象
     */
    @Override
    public GeConScienceFeedback queryById() {
        return this.geConScienceFeedbackDao.queryById();
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConScienceFeedback> queryAllByLimit(int offset, int limit) {
        return this.geConScienceFeedbackDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConScienceFeedback> getinfoByScienceId(int id) {
        return this.geConScienceFeedbackDao.getinfoByScienceId(id);
    }

    /**
     * 新增数据
     *
     * @param geConScienceFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConScienceFeedback insert(GeConScienceFeedback geConScienceFeedback) {
        this.geConScienceFeedbackDao.insert(geConScienceFeedback);
        return geConScienceFeedback;
    }

    /**
     * 修改数据
     *
     * @param geConScienceFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConScienceFeedback update(GeConScienceFeedback geConScienceFeedback) {
        this.geConScienceFeedbackDao.update(geConScienceFeedback);
        return this.queryById();
    }

    /**
     * 通过主键删除数据
     *
     * @param 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById() {
        return this.geConScienceFeedbackDao.deleteById() > 0;
    }

    @Override
    public boolean deleteByScienceId(int id) {
        return this.geConScienceFeedbackDao.deleteByScienceId(id) > 0;
    }
}
